"""命令行选项参数模块

包含有 base_options, train_options, test_options。
"""

import os
from collections import Sized

def parse_sequence(seq, separator=',', type_func=str) -> list:
    """解析序列为 Python 列表"""
    if seq is not None and len(seq) > 0:
        return [type_func(s) for s in seq.split(separator)]
    return []

def is_empty(obj: object) -> bool:
    """判断 obj 是否为空。若为空返回 True，否则返回 False"""
    if obj is None:
        return True
    if isinstance(obj, Sized):
        return len(obj) == 0
    return False
